home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
prog
/
atari
/
m2
/
cat3src
/
cat
/
searchhe.i
< prev
next >
Wrap
Text File
|
1997-10-26
|
8KB
|
299 lines
IMPLEMENTATION MODULE SearchHelp;
IMPORT Varnames;
IMPORT CatTypes;
IMPORT Strings;
IMPORT ConfVars;
IMPORT MagicStrings;
FROM Void IMPORT v;
PROCEDURE IsValidSearch (str: ARRAY OF CHAR): BOOLEAN;
BEGIN
(* Jetzt der eigentliche Test *)
WHILE ((str[0] = '*') OR (str[0] = '?')) &
(MagicStrings.Length (str) > 0) DO
MagicStrings.Delete (str, 0, 1);
IF MagicStrings.Length (str) = 0
THEN
RETURN FALSE
END;
END;
RETURN TRUE
END IsValidSearch;
PROCEDURE ValidateKonf (VAR konf: SearchRecordType): BOOLEAN;
VAR i: INTEGER;
BEGIN
(* Nur bei groer Suchbox: Flageinstellungen berprfen *)
(* Erster Test: Suchstring leer und Textsuche *)
IF (LENGTH(konf.searchStr[0]) = 0) & konf.searchText
THEN
RETURN FALSE;
END;
IF ~konf.searchText & ~konf.statussearch
THEN
RETURN FALSE;
END;
IF ~konf.show & ~konf.change
THEN
(* Entweder Show oder Change mssen an sein *)
RETURN FALSE;
END;
IF konf.statussearch
THEN
IF konf.sSetBits + konf.sClearedBits = {}
THEN
RETURN FALSE;
END;
IF konf.change
& (konf.setBits + konf.clearBits = {})
THEN
RETURN FALSE;
END;
END;
IF konf.searchText
THEN
FOR i := 0 TO suchstringAnz - 1 DO
IF ~IsValidSearch (konf.searchStr[i])
THEN
RETURN FALSE
END;
END;
END;
RETURN TRUE;
END ValidateKonf;
PROCEDURE getsetKonf(set : BOOLEAN; nr : CARDINAL; VAR konf : SearchRecordType):BOOLEAN;
(* Suchkonfiguration <nr> abrufen, FALSE -> nicht gesetzt *)
VAR varname,
varname2 : CatTypes.String255;
short : ARRAY[0..1] OF CHAR;
z : CARDINAL;
scrap : INTEGER;
OneWasThere : BOOLEAN;
writeOk : BOOLEAN;
BEGIN
OneWasThere := FALSE;
writeOk := TRUE;
IF nr > 9 THEN RETURN FALSE END;
short[0] := CHR(nr+ORD('0')); short[1] := 0C;
Strings.Concat (cSearchStr, short, varname, v.bool);
Strings.Concat (varname, '.', varname, v.bool);
FOR z := 0 TO 3 DO
short[0] := CHR(z+ORD('0'));
Strings.Concat (varname, short, varname2, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigString(varname2, konf.searchStr[z]);
ELSE
IF ConfVars.GetConfigString (varname2, konf.searchStr[z]) THEN
OneWasThere := OneWasThere OR (konf.searchStr[z][0] # 0C);
ELSE
konf.searchStr[z] := '';
END;
END;
END;
short[0] := CHR(nr+ORD('0'));
Strings.Concat (cSearchLogical, short, varname, v.bool);
Strings.Concat (varname, '.', varname, v.bool);
FOR z := 0 TO 2 DO
short[0] := CHR(z+ORD('0'));
Strings.Concat (varname, short, varname2, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigInt(varname2, konf.verkn[z]);
ELSE
IF ConfVars.GetConfigInt (varname2, konf.verkn[z]) THEN
OneWasThere := TRUE
ELSE
konf.verkn[z] := vUND
END;
END;
END;
short[0] := CHR(nr+ORD('0'));
Strings.Concat (cSearchLocation, short, varname, v.bool);
Strings.Concat (varname, '.', varname, v.bool);
FOR z := 0 TO 3 DO
short[0] := CHR(z+ORD('0'));
Strings.Concat (varname, short, varname2, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigInt(varname2, konf.wo[z]);
ELSE
IF ConfVars.GetConfigInt (varname2, konf.wo[z]) THEN
OneWasThere := TRUE
ELSE
konf.wo[z] := sUEBERALL;
END;
END;
END;
short[0] := CHR(nr+ORD('0'));
Strings.Concat (cSearchShow, short, varname, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigBool(varname, konf.show);
ELSE
IF ConfVars.GetConfigBool(varname, konf.show) THEN
OneWasThere := TRUE
ELSE
konf.show := TRUE;
END;
END;
Strings.Concat (cSearchChange, short, varname, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigBool(varname, konf.change);
ELSE
IF ConfVars.GetConfigBool(varname, konf.change) THEN
OneWasThere := TRUE
ELSE
konf.change := FALSE;
END;
END;
Strings.Concat (cSearchStatus, short, varname, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigBool(varname, konf.statussearch);
ELSE
IF ConfVars.GetConfigBool(varname, konf.statussearch) THEN
OneWasThere := TRUE
ELSE
konf.statussearch := FALSE;
END;
END;
Strings.Concat (cSearchAsk, short, varname, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigBool(varname, konf.ask);
ELSE
IF ConfVars.GetConfigBool(varname, konf.ask) THEN
OneWasThere := TRUE
ELSE
konf.ask := TRUE;
END;
END;
Strings.Concat (cSearchText, short, varname, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigBool(varname, konf.searchText);
ELSE
IF ConfVars.GetConfigBool(varname, konf.searchText) THEN
OneWasThere := TRUE
ELSE
konf.searchText := TRUE;
END;
END;
Strings.Concat (cSearchCasesensitive, short, varname, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigBool(varname, konf.gross);
ELSE
IF ConfVars.GetConfigBool(varname, konf.gross) THEN
OneWasThere := TRUE
ELSE
konf.gross := TRUE;
END;
END;
Strings.Concat (cNoGroupBorder, short, varname, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigBool(varname, konf.groupsearch);
ELSE
IF ConfVars.GetConfigBool(varname, konf.groupsearch) THEN
OneWasThere := TRUE
ELSE
konf.groupsearch := FALSE;
END;
END;
Strings.Concat (cSearchSetBits, short, varname, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigInt(varname, INTEGER(konf.sSetBits));
ELSE
IF ConfVars.GetConfigInt(varname, scrap) THEN
konf.sSetBits := BITSET(scrap);
OneWasThere := TRUE
ELSE
konf.sSetBits := {};
END;
END;
Strings.Concat (cSearchClearedBits, short, varname, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigInt(varname, INTEGER(konf.sClearedBits));
ELSE
IF ConfVars.GetConfigInt(varname, scrap) THEN
konf.sClearedBits := BITSET(scrap);
OneWasThere := TRUE
ELSE
konf.sClearedBits := {};
END;
END;
Strings.Concat (cSearchToSetBits, short, varname, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigInt(varname, INTEGER(konf.setBits));
ELSE
IF ConfVars.GetConfigInt(varname, scrap) THEN
konf.setBits := BITSET(scrap);
OneWasThere := TRUE
ELSE
konf.setBits := {};
END;
END;
Strings.Concat (cSearchToClearBits, short, varname, v.bool);
IF set THEN
writeOk := writeOk & ConfVars.SetConfigInt(varname, INTEGER(konf.clearBits));
ELSE
IF ConfVars.GetConfigInt(varname, scrap) THEN
konf.clearBits := BITSET(scrap);
OneWasThere := TRUE
ELSE
konf.clearBits := {};
END;
END;
IF set THEN
RETURN writeOk;
ELSE
RETURN OneWasThere;
END;
END getsetKonf;
PROCEDURE getKonf(nr : CARDINAL; VAR konf : SearchRecordType):BOOLEAN;
(* Suchkonfiguration <nr> abrufen, FALSE -> nicht gesetzt *)
BEGIN
RETURN getsetKonf(FALSE, nr, konf);
END getKonf;
PROCEDURE setKonf(nr : CARDINAL; konf : SearchRecordType):BOOLEAN;
(* Suchkonfiguration <nr> setzen *)
BEGIN
RETURN getsetKonf(TRUE, nr, konf);
END setKonf;
BEGIN
WITH suchVar DO
searchStr[0] := ''; searchStr[1] := ''; searchStr[2] := ''; searchStr[3] := '';
verkn[0] := vUND;
verkn[1] := vUND;
verkn[2] := vODER;
wo[0] := sUEBERALL;
wo[1] := sUEBERALL;
wo[2] := sUEBERALL;
wo[3] := sUEBERALL;
show := TRUE;
change := FALSE;
statussearch := FALSE;
ask := TRUE;
searchText := TRUE;
gross := TRUE;
sSetBits := {}; sClearedBits := {}; setBits := {}; clearBits := {};
END;
END SearchHelp.